package com.iap.common.command
{
	import com.iap.common.model.Client;
	import com.iap.common.service.IClientService;
	import com.iap.common.signal.ClientRequestSignal;
	
	import org.robotlegs.mvcs.SignalCommand;
	
	public class ClientCommand extends SignalCommand
	{
		[Inject]
		public var service:IClientService;
		[Inject]
		public var model:Client;
		[Inject]
		public var task:String;
		
		override public function execute():void
		{
			service.task = task;
			switch(task)
			{
				case ClientRequestSignal.GET:
				{
					service.get(model);
					break;
				}
				case ClientRequestSignal.SAVE:
				{
					service.save(model);
					break;
				}
				case ClientRequestSignal.DELETE:
				{
					service.remove(model);
					break;
				}
			}
		}
	}
}